home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*
- * rock -
- * play some samples
- *
- * Paul Haeberli and Bruce Karsh - 1991
- */
- #include "math.h"
- #include "stdio.h"
- #include "gl.h"
- #include "device.h"
- #include "sample.h"
-
- sample *p1, *p2, *p3, *p4;
- sample *go, *stop, *yeah, *rest;
- sample *in, *di, *hollywood;
-
- main(argc,argv)
- int argc;
- char **argv;
- {
- sample *s1, *s2, *s3, *s4, *s;
- int max;
- int j;
-
- sethumanize(0.02,0.2);
- if(argc>1)
- setbpm(atof(argv[1]));
- else
- setbpm(405.0);
- p1 = readsample("bash1.a");
- p2 = readsample("bash2.a");
- p3 = readsample("bash3.a");
- p4 = readsample("bash4.a");
- hollywood = readsample("hollywood.a");
- expandsample(hollywood);
- rest = clonesample(p4);
- scalesample(rest,0.0);
- go = readsample("go.a");
- stop = readsample("stop.a");
- yeah = readsample("yeah.a");
- in = readsample("in.a");
- di = readsample("di.a");
- donote(in);
- donote(in);
- donote(in);
- donote(di);
- donote(di);
- donote(di);
- donote(go);
- donote(go);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- while(1) {
- j++;
- if((j%5) == 0) {
- donote(go);
- donote(go);
- donote(in);
- donote(go);
- donote(in);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(in);
- donote(di);
- donote(go);
- donote(hollywood);
- donote(rest);
- donote(rest);
-
- donote(rest);
- donote(rest);
- donote(rest);
- } else if( (j%10) == 0 ) {
- donote(stop);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(rest);
- donote(rest);
- } else if( (j%10) == 0 ) {
- donote(stop);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(rest);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- donote(yeah);
- } else {
- donote(p1);
- donote(rest);
- }
- donote(p4);
- donote(rest);
- donote(p1);
- donote(rest);
- donote(p4);
- donote(rest);
- donote(p1);
- donote(go);
- donote(p4);
- if(j & 2)
- donote(go);
- else
- donote(p2);
-
- donote(p1);
-
- if(j & 1)
- donote(go);
- else
- donote(p2);
-
- donote(p4);
- donote(p1);
- donote(p1);
- donote(p4);
- donote(p4);
- if(j&1)
- donote(yeah);
- else
- donote(stop);
- }
- }
-
- maybe()
- {
- if((random()%8) == 0)
- donote(rest);
- else
- donote(p2);
- }
-
- randbeat()
- {
- switch(random()%10) {
- case 0:
- case 1:
- case 2:
- case 3:
- donote(go);
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- donote(stop);
- break;
- case 8:
- case 9:
- donote(rest);
- break;
- }
- }
-
- double now;
-
- donote(s)
- sample *s;
- {
- flushnotes(now-4.0);
- playnote(s,now,1.0);
- now = now+1;
- }
-